package cs340.stormtroopers.junitTests;

import cs340.stormtroopers.hypeerweb.HyPeerWeb;
import cs340.stormtroopers.hypeerweb.Node;
import junit.framework.TestCase;

public class DeletionPointTest extends TestCase
{
	// will test all possible sizes of < HYPEERWEB_SIZE
	private int HYPEERWEB_SIZE = 500;

	public void testDeletionPoints()
	{
		HyPeerWeb hypeerWeb = HyPeerWeb.getSingleton();
		hypeerWeb.clear();
		Node originalNode = new Node(0);
		hypeerWeb.addToHyPeerWeb(originalNode, null);

		for (int i = 0; i < HYPEERWEB_SIZE - 1; i++)
		{
			Node nodeToAdd = new Node(0);
			originalNode.addToHyPeerWeb(nodeToAdd);

			for (int j = 0; j < i; j++)
			{
				Node nodeToStartDeletion = hypeerWeb.getNode(j);
				int val = nodeToStartDeletion.findDeletionPoint()
						.getWebIdValue();
				assertTrue(val == (hypeerWeb.size() - 1));
			}

		}

	}

}
